package com.gy.ai.agent.platform.dashscope.entity;

import com.gy.ai.agent.core.BaseResponse;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author LGY
 * Create by 2025/6/19 17:02
 */
@Data
@Accessors(chain = true)
public class DashscopePlatformChatResp extends BaseResponse implements Serializable {

    private String id;

    private List<Choices> choices;

    private Long created;

    private String model;

    private String object;

    private String service_tier;

    private String system_fingerprint;

    private Usage usage;

    @Data
    @Accessors(chain = true)
    public static class Usage implements Serializable {

        private Long audio_tokens;

        private Long cached_tokens;

        private Long text_tokens;

        private Long image_tokens;

        private Long video_tokens;
    }

    @Data
    @Accessors(chain = true)
    public static class Message implements Serializable {

        private String content;

        private String refusal;

        private String role;

        private Object audio;

        private Object function_call;

        private List<ToolCalls> tool_calls;
    }

    @Data
    @Accessors(chain = true)
    public static class ToolCalls implements Serializable {

        private String id;

        private String type;

        private Function function;

        private Integer index;
    }

    @Data
    @Accessors(chain = true)
    public static class Function implements Serializable {

        private String name;

        private String arguments;
    }

    @Data
    @Accessors(chain = true)
    public static class Choices implements Serializable {

        private String finish_reason;

        private Integer index;

        private Logprobs logprobs;

        private Delta delta;

        private Message message;
    }

    @Data
    @Accessors(chain = true)
    public static class Delta implements Serializable {
        private String content;

        private String reasoning_content;

        private Object function_call;

        private Audio audio;

        private Object refusal;

        private String role;

        private List<ToolCalls> tool_calls;
    }

    @Data
    @Accessors(chain = true)
    public static class Audio implements Serializable {

        private String transcript;
        private String data;
        private Long expires_at;
    }

    @Data
    @Accessors(chain = true)
    public static class Logprobs implements Serializable {

        private List<Content> content;
    }

    @Data
    @Accessors(chain = true)
    public static class Content implements Serializable {

        private String token;

        private Byte[] bytes;

        private BigDecimal logprob;

        private List<TopLogprobs> top_logprobs;
    }

    @Data
    @Accessors(chain = true)
    public static class TopLogprobs implements Serializable {

        private Byte[] bytes;

        private String token;

        private BigDecimal logprob;
    }
}
